package com.cy.pj.common.pool;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;

/**
 * @author Administrator
 */
@Scope("prototype")
@Component
public class ObjectPool {

    public ObjectPool(){
        System.out.println("ObjectPool()");
    }

    /**生命周期初始化方法,构造方法之后执行,可以在方法内部作用一些初始化*/
    @PostConstruct
    public void init(){
        System.out.println("init()");
    }

    /**生命周期销毁方法,GC执行之前进行,释放资源*/
    @PreDestroy
    public void close(){
        System.out.println("close()");
    }
}
